<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAdminUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name',50)->default('')->comment('用户名');
            $table->string('password',100)->default('')->comment('密码');
            $table->string('phone',20)->default('')->unique()->comment('手机号');
            $table->bigInteger('parent_id')->index()->default(0)->comment('父级ID');
            $table->tinyInteger('type')->default(0)->comment('用户类型1平台2经销商3商户4操作员');
            $table->string('avatar')->default('/images/avatar/default.jpg')->comment('头像');
            $table->tinyInteger('available')->default(0)->comment('0待审核,1通过审核,2未通过审核');
            $table->string('last_ip',100)->default('0.0.0.0')->comment('最后一次登录的IP');
            $table->tinyInteger('state')->default(1)->comment('用户状态1正常2冻结');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_users');
    }
}
